﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=1">
    <meta name="format-detection" content="telephone=no">
    <meta charset="UTF-8">
    <title>父传子props</title>
    <link rel="stylesheet" href="../css/bootstrap.css"/>
    <script src="../js/jquery-2.2.0.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
</head>
<body>
<h1>父传子props</h1><br/>

<div id="app">
    {{name}}<br/>
    <parent></parent>
</div>
<script src="../js/vue-2.5.16.js"></script>
<script src="../node_modules/axios/dist/axios.js"></script>
<script src="../node_modules/lodash/lodash.js"></script>

<script>
    /**
     * 互相嵌套父子层级格式
     * <div>
     *     parent
     *     <div>
     *         son
     *         <div>grandson</div>
     *     </div>
     * </div>
     *
     */
    let grandson = {
        template:'<div>grandson</div>'
    };
    let son = {
        template:'<div>son<grandson></grandson></div>',
        components:{
            grandson
        }
    };
    let parent = {
        template:'<div>parent<son></son></div>',
        components:{
            son
        }
    };

    var app = new Vue({
        el:'#app',
        data:{
            name:'模版数据'
        },
        components:{
            parent
        }
    });
</script>

</body>
</html>